#!/bin/bash

#    / **  
#    * 文件名：安装linux软件
#    * 版权： Copyright 谢振斌 All Rights Reserved.  
#    * 修改内容：新增  
#    * 修改人： 谢振斌  
#    * 修改时间：2021-9-21 
#    */  



#    / **  
#    *〈流程控制〉  
#    *〈该脚本的主函数〉  
#    * @param [无]  
#    * @return [无]  
#    * @exception/throws [无]  
#    * @deprecated  
#    */  
function processControlMain()  
{  
    # 打印当前系统时间  
    echo "Start..."  
    date  

    # 此处是你的代码  
    # ...  

    # 安装 权限模块
    pkg install tsu

    # 安装 tmux
    pkg install tmux

    # 安装SSH服务
    pkg install openssh

    # 安装 git
    pkg install git

    git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
    cd ~/.fzf
    ./install
    
    pkg install lua

    git clone --depth=1 https://github.com/skywind3000/z.lua  ~/.config/z.lua

    git clone --depth=1 https://ghproxy.com/https://github.com/zsh-users/zsh-autosuggestions  ~/.config/zsh-autosuggestions
    git clone --depth=1 https://ghproxy.com/https://github.com/zsh-users/zsh-history-substring-search  ~/.config/zsh-history-substring-search
    git clone --depth=1 https://ghproxy.com/https://github.com/zsh-users/zsh-syntax-highlighting  ~/.config/zsh-syntax-highlighting
    git clone --depth=1 https://ghproxy.com/https://github.com/jeffreytse/zsh-vi-mode ~/.config/zsh-vi-mode
    git clone --depth=1 https://ghproxy.com/https://github.com/Nyquase/vi-mode ~/.config/vi-mode

    git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
    cd ~/.fzf
    ./install

    # 安装
    
    # 打印当前系统时间  
    date  
    echo "The End."  
}  

# 执行入口 
# 进入脚本目录位置
#cd `dirname $0`
# 获取当前脚本目录位置
shellfilepath=`pwd`'/'$0
# 打印脚本目录地址
echo "[INFO]: 脚本地址 "${shellfilepath}

if true  
# if false  
then  
    echo "[Debug] true"
    # 开始执行  从标准输入中读取并同时写入到标准输出和指定的文件上 
    ## 拼接日志文件地址
    #logfilepath=`pwd`'/'$0'.log'
    #logfilepath=`pwd`'/'$0'-'$(date +%Y%m%d)'.log'
    logfilepath=$0'-'$(date +%Y%m%d)'.log'
    #logfilepath=`pwd`'/'$0'-'$(date +%y%m%d-%H-%M-%S)'.log'
    ## 打印日志文件地址
    echo "[INFO]: 日志地址" ${logfilepath}
    processControlMain  | tee -a ${logfilepath}
else  
    echo "[Debug] false"  
    ## 函数单元测试  
    #  
fi  

# 脚本结束  

